﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TPOJ.IDAL;
using TPOJ.DALFactory;
using TPOJ.Model;

namespace TPOJ.BLL
{
    public class SolutionBO
    {
        private static readonly ISolutionDAO dal = DataAccess.CreateSolutionDAO();

        public Solution AddSolution(int problemId, string language, string code, int userId, int? contestId,DateTime submitTime)
        {
            return dal.AddSolution(problemId, language, code, userId, contestId, submitTime);
        }

        public void EditSolution(Solution solution, bool isAC)
        {
            dal.EditSolution(solution, isAC);
        }

        public IList<Solution> GetAllSolutions()
        {
            return dal.GetAllSolutions();
        }

        public Solution GetSolution(int id)
        {
            return dal.GetSolution(id);
        }

        public IList<Solution> GetContestSolutions(int contestId)
        {
            return dal.GetContestSolutions(contestId);
        }

        public IList<Solution> GetProblemSolutions(int problemId)
        {
            return dal.GetProblemSolutions(problemId);
        }

        public IList<int> GetSolvedProblemIdsByUser(int userId)
        {
            return dal.GetSolvedProblemIdsByUser(userId);
        }

        public IList<int> GetTriedNotACedProblemIdsByUser(int userId)
        {
            return dal.GetTriedNotACedProblemIdsByUser(userId);
        }

        public IList<int> GetSolvedProblemIdsByUserInContest(int userId, int contestId)
        {
            return dal.GetSolvedProblemIdsByUserInContest(userId, contestId);
        }

        public IList<int> GetTriedNotACedProblemIdsByUserInContest(int userId, int contestId)
        {
            return dal.GetTriedNotACedProblemIdsByUserInContest(userId, contestId);
        }
    }
}
